using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using WebServiceTI.ServiceContracts;

namespace WebServiceTI.ServiceImplementation
{
    [ServiceBehavior(Name = "TaskManager", Namespace = "http://WebServiceTI.ServiceContracts/2008/01")]
    public class TaskManager : ITaskManager
    {
        static WebServiceTI.BusinessLogic.TaskManager Manager = new WebServiceTI.BusinessLogic.TaskManager();
        #region ITaskManager Members

        public AddTaskRespones AddTask(AddTaskRequest request)
        {
            Manager.AddNewTask( TranslateBetweenTaskAndTask.TranslateTaskToTask( request.new_task) );
            return new AddTaskRespones();
        }

        public GetTaskListResponse GetTaskList(GetTaskListRequest request)
        {
            System.Collections.Generic.List<WebServiceTI.BusinessEntities.Task> list = Manager.GetTaskList();
            GetTaskListResponse response = new GetTaskListResponse();
            response.TaskList = new List<WebServiceTI.DataContracts.Task>();
            foreach (WebServiceTI.BusinessEntities.Task task in list)
            {
                response.TaskList.Add(TranslateBetweenTaskAndTask.TranslateTaskToTask(task));
            }
            return response;
        }

        #endregion
    }
}
